package com.shuqi.model.parse;

import java.util.List;

import android.app.Activity;
import android.content.Context;

import com.shuqi.interfaces.OnAfterLoadPage;
import com.shuqi.model.bean.BookContentInfo;

/**
 * @remark BookContentParserBase interface
 * @author HuaWei.Yang
 * @date 2013-12-19 上午10:29:22
 * @version 1.0
 */
public abstract class BookContentParserBase {

    public interface OnOneChpaterLoadDone {
        void oneChapterLoadDone(boolean isRefreshUI);
    };

    /**
     * 加载数据
     * 
     * @param context
     * @param params BookContentInfo:
     * @param byteIndex
     * @return
     */
    public BookContentInfo getCurInfos(Context context, BookContentInfo params, boolean isNext) {
        return getCurInfos(context, params, isNext, null);
    };
    
    /** 根据进度获取章节名 */
    public BookContentInfo getCurCharpterNameFromProgress(Context context, BookContentInfo params){
        return getCurCharpterNameFromProgress(context, params);
    }

    public abstract BookContentInfo getCurInfos(Context context, BookContentInfo params,
            boolean isNext, OnOneChpaterLoadDone callBack);

    /** 获取缓存中的当前章 */
    public abstract BookContentInfo getCurrInfo(Activity context);

    /** 连网获取上一章 */
    public abstract void loadPrevInfo(Activity context, OnAfterLoadPage onAfterLoadPage,
            BookContentInfo params);

    /** 连网获取下一章 */
    public abstract void loadNextInfo(Activity context, OnAfterLoadPage onAfterLoadPage,
            BookContentInfo params);

    /** 是否有上一章节 */
    public abstract boolean hasPreChapter(int index);

    /** 是否有下一章节 */
    public abstract boolean hasNextChapter(int index);

    /** 获取当前目录 ：在线用不到7.0.7 */
    public abstract List<BookContentInfo> getBookCatalogList();

    /** 是否正在预加载 */
    public abstract boolean isPageFetching();
    
    /** 本地是否有缓存数据*/
    public boolean hasLocalCachedData(String bookId,String sourceId,String chapterId,String uid){
        return true;
    }

    /*** 书包中获得其实位置的chapterId */
    public int getPostion(String chapterId) {
        return 0;
    }

    public String getChapterId(int position) {
        return "";
    }

}
